<template>
  <div class='container'>
    <div class='app-row m-20-t'>
      <span class="title bold width-100 align-right">问题内容:</span>
      <el-input class='flex-1' v-model="content_value"></el-input>
    </div>

    <div class='app-row m-20-t'>
      <span class="title bold width-100 align-right">介绍:</span>
      <div style="width: 90%">
       <el-input type="textarea" :rows="4" v-model="text_value" placeholder="请输入内容"></el-input>

      </div>
    </div>
    <div class="app-row j-c-c m-100-t">
      <el-button type="success" @click="edit_button">确认编辑</el-button>
    </div>
    <el-dialog
      title="选择要拼团的商品"
      :visible.sync="choose_dialog"
      width="30%">
      <span slot="footer" class="dialog-footer">
        <el-button @click="choose_dialog = false">取 消</el-button>
        <el-button type="primary" @click="confirm_button">确 定</el-button>
      </span>
    </el-dialog>
  </div>
</template>

<script>
  import question_request from "@/api/question_request"
  export default {
    name: 'question_edit',
    data() {
      return {
        content_value: "",
        description_value: "",
        url_value: "",
        open_radio: "1",
        price_value: '',
        choose_dialog: false,
        setting_question: false,
        text_value: '',
        rank_value: '',
      }
    },
    created() {
      this.get_detail(this.$route.query.id)
    },
    mounted() {
  
    },
    methods: {
      edit_button() {
        let params = {
          id: this.$route.query.id,
          content: this.content_value
        }
        question_request.edit_question(params, res=> {
          this.$router.push('/QA/question')
        })
      },
      get_detail(id) {
        question_request.detail_question({id}, res=> {
          let result = res.data
          this.content_value = result.content
        })
      },
      choose_question() {
        this.choose_dialog = true
      },
      confirm_button() {
        this.choose_dialog = false
        this.setting_question = true
      }

    }
  }
</script>

<style scoped>
@import "~@/styles/layout.scss";
</style>